package com.cl.mypureframe.activity;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.WindowManager;

import com.cl.mypureframe.BaseApplication;
import com.cl.mypureframe.R;
import com.cl.mypureframe.util.GLobalConstant;


/**
 * WelcomeActivity
 * Created by Lei on 2016/8/26.
 */
public class WelcomeActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);

        new Handler(Looper.myLooper(), new Handler.Callback() {
            @SuppressWarnings("deprecation")
            @Override
            public boolean handleMessage(Message msg) {
                if (!BaseApplication.basePreferences.readIsGuide()) {
                    startVerifyActivity(GuideActivity.class);
                } else if (!TextUtils.equals(getUserId(), GLobalConstant.USERID)) {// TODO 测试前面取非，正式去掉非
                    startMActivity(LoginActivity.class);
                    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
                } else {
                    startMActivity(MainActivity.class);
                    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
                }
                finish();
                return false;
            }
        }).sendEmptyMessageDelayed(0, GLobalConstant.WELTIME);

    }

    @Override
    public void onBackPressed() {
    }

}